package DataBase;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

public class CreateTableOracle {
    public static void main(String[] args) {
           String jdbcUrl = "jdbc:oracle:thin:@localhost:1521:xe";
        String userid = "hr"; // gantikan dengan username anda
        String password = "ria"; // gantikan dengan password anda

        Connection conn;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(jdbcUrl);
            conn = ds.getConnection(userid, password);
            System.out.println("Koneksi is OK");
            Statement statement = conn.createStatement();

            String sql = " CREATE table YUDISIUM ( NAMA VARCHAR2(100) NOT NULL,NIM VARCHAR2(20) NOT NULL, "
                    + "NOMOR_HP VARCHAR2(100) NOT NULL,PRODI VARCHAR2(100) NOT NULL,"
                    + "BULAN_YUDISIUM VARCHAR2(20) NOT NULL,"
                    + "HARI_YUDISIUM VARCHAR2(20) NOT NULL,TANGGAL_YUDISIUM VARCHAR2(20) NOT NULL,"
                    + "DAFTAR_NILAI VARCHAR2 (20) NOT NULL,NASKAH_TA VARCHAR2 (20) NOT NULL,"
                    + "BEBASPINJAM_LAB VARCHAR2 (20) NOT NULL,BEBASPINJAM_DOSEN VARCHAR2 (20) NOT NULL,"
                    + "BUKTI_KP VARCHAR2 (20) NOT NULL,TOELF_TKBI VARCHAR2 (20) NOT NULL,"
                    + "KET_KKL VARCHAR2 (20) NOT NULL,FILE_KET VARCHAR2 (20) NOT NULL,KETERANGAN VARCHAR2 (80) NOT NULL,"
                                    + "constraint YUDISIUM_PK primary key (NIM) ENABLE)";

            statement.executeUpdate(sql);

        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
